<script setup>
import { GetCategoryService } from '@/api/vegeFru'
import { ref } from 'vue'

defineProps({
  modelValue: {
    type: [Number, String]
  },
  width: {
    type: [String]
  }
})
const emit = defineEmits(['update:modelValue'])
const categoryList = ref([])
const getCategoryList = async () => {
  const res = await GetCategoryService()
  categoryList.value = res.data.data
}
getCategoryList()
const onUpdate = ($event) => {
  emit('update:modelValue', $event)
}
</script>
<template>
  <!-- <el-select :modelValue="modelValue" @change="onUpdate($event)" :style="{ width }"> -->
  <el-select :modelValue="modelValue" @change="onUpdate($event)" style="width: 100%">
    <el-option v-for="item in categoryList" :key="item.st" :label="item.st" :value="item.st" />
  </el-select>
</template>
